Derivative of cos x using first principle